﻿////using System;
////using System.Collections.Generic;
////using System.Linq;
////using System.Text;

////namespace MetaProperties.Core
////{
////    using System.ComponentModel;

////    using Framework;

////    [Obsolete]
////    public class SourcedObservable<T> : GenericBoundObservable<T>
////    {
////        private IObservable<T> source;

////        Action<T> setValueMethod;

////        public SourcedObservable()
////        {
////        }

////        public SourcedObservable(T defaultValue)
////        {
////            this.DefaultValue = defaultValue;
////        }

////        public void SetSource(IObservable<T> source)
////        {
////            this.SetSource(source, null);
////        }

////        public void SetSource(IObservable<T> source, Action<T> setValueMethod)
////        {
////            if (source == null)
////            {
////                throw new ArgumentNullException("source");
////            }

////            this.ClearSource();

////            this.source = source;
////            this.setValueMethod = setValueMethod;
////            this.ObservableValue.Value = this.source.Value;
////            this.source.ValueChanged += this.Source_ValueChanged;

////            if (this.setValueMethod != null)
////            {
////                this.ObservableValue.ValueChanged += this.ObservableValue_ValueChanged;
////            }
////        }

////        public override void Unbind()
////        {
////            this.ClearSource();
////        }

////        protected override bool IsBound
////        {
////            get { return this.IsSourceSet; }
////        }

////        public void ClearSource()
////        {
////            if (this.source != null)
////            {
////                this.source.ValueChanged -= this.Source_ValueChanged;

////                if (this.setValueMethod != null)
////                {
////                    this.ObservableValue.ValueChanged -= this.ObservableValue_ValueChanged;
////                }

////                this.source = null;
////                this.setValueMethod = null;
////                this.ObservableValue.Value = this.DefaultValue;
////            }
////        }

////        private void ObservableValue_ValueChanged(object sender, ValueChangedEventArgs<T> e)
////        {
////            if (this.setValueMethod != null)
////            {
////                this.setValueMethod(e.NewValue);
////            }
////        }

////        private void Source_ValueChanged(object sender, ValueChangedEventArgs<T> e)
////        {
////            this.ObservableValue.Value = e.NewValue;
////        }

////        protected bool IsSourceSet
////        {
////            get { return this.source != null; }
////        }
////    }
////}
